package com.yhn.shortlink.project.controller;

import com.yhn.shortlink.common.model.BaseResponse;
import com.yhn.shortlink.common.model.ResultUtils;
import com.yhn.shortlink.project.service.UrlTitleService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/** URL标题控制层
 * 短链接不存在跳转控制器
 * @author yhnyhn123
 */
@RestController

public class UrlTitleController {
    @Resource
    private UrlTitleService urlTitleService;

	/**
     * 短链接不存在跳转页面
     */
    @GetMapping("/title")
    public BaseResponse<String> getTitleByUrl(@RequestParam("url") String url) {
        return ResultUtils.success(urlTitleService.getTitleByUrl(url));
    }
}
